/*
 *
 * Copyright 2017-2018. All rights reserved.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, see <http://www.gnu.org/licenses/>.
 *
 */
package com.loveprogrammer.eternity.enums;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

/**
 * 种族
 *
 * @author eric
 * @version 1.0.0
 */
public enum HeroPropertiesEnum {

    战士(1, "战士",2.5,0,1.5,1.0,4,1.3),
    法师(2, "法师",0.0,2.5,1.8,1.0,0.8,0.8),
    大法师(150, "大法师",0.0,2.5,1.8,1.0,0.8,0.8),
    术士(151, "术士",0.0,2.2,2.0,1.0,0.8,1.3),
    刺客(3, "刺客",2.0,0,2.5,1.5,0.8,1.1),
    火枪手(4, "火枪手",3,0,1.3,1.1,0.8,0.8),
    牧师(5, "牧师",0.0,2.5,1.8,1.0,0.8,1.1),
    野蛮人(6, "野蛮人",3,0.0,1.2,1.3,0.8,1.5),
    萨满(7, "萨满",0.0,1.9,2.3,1.0,0.8,0.8),
    死灵法师(8, "死灵法师",0.0,1.8,1.8,1.0,0.8,0.8),
    圣骑士(9, "圣骑士",2.0,0.0,1.8,1.0,1.5,1.1);

    private Integer code;

    private String desc;

    private double strengthRatio;
    private double magicRatio;
    private double techniqueRatio;
    private double speedRatio;
    private double armatureRatio;
    private double constitutionRatio;

    HeroPropertiesEnum(Integer code, String desc, double strengthRatio,
                       double magicRatio, double techniqueRatio,
                       double speedRatio, double armatureRatio,
                       double constitutionRatio) {
        this.code = code;
        this.desc = desc;
        this.strengthRatio = strengthRatio;
        this.magicRatio = magicRatio;
        this.techniqueRatio = techniqueRatio;
        this.speedRatio = speedRatio;
        this.armatureRatio = armatureRatio;
        this.constitutionRatio = constitutionRatio;
    }

    public static HeroPropertiesEnum getById(int id){
        Optional<HeroPropertiesEnum> optional =
                Arrays.stream(HeroPropertiesEnum.values())
                        .filter(v -> Objects.equals(v.getCode(), id))
                        .findFirst();

        return optional.orElse(HeroPropertiesEnum.战士);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public double getStrengthRatio() {
        return strengthRatio;
    }

    public double getMagicRatio() {
        return magicRatio;
    }

    public double getTechniqueRatio() {
        return techniqueRatio;
    }

    public double getSpeedRatio() {
        return speedRatio;
    }

    public double getArmatureRatio() {
        return armatureRatio;
    }

    public double getConstitutionRatio() {
        return constitutionRatio;
    }
}
